/*
 * 
 *
 * Authors: Soeren Gebbert, soeren.gebbert@vti.bund.de
 *          Axel Don, axel.don@vti.bund.de
 *
 * Copyright:
 *
 * Johann Heinrich von Thünen-Institut
 * Institut für Agrarrelevante Klimaforschung
 *
 * Phone: +49 (0)531 596 2601
 *
 * Fax:+49 (0)531 596 2699
 *
 * Mail: ak@vti.bund.de
 *
 * Bundesallee 50
 * 38116 Braunschweig
 * Germany
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef CARB_PARTICLE_H
#define CARB_PARTICLE_H

#include <stdlib.h>
#include <math.h>
#include <stdio.h>

#include "particle_base.h"

/* A single carbon particle */
class carb_particle : public particle_base {
public:
    carb_particle();
    carb_particle(initial_parameters *init_params, runtime_parameters *run_params);
    carb_particle(float x, float y, float z, float mass, int age, bool is_doc,
            initial_parameters *init_params, runtime_parameters *run_params);
    
    /** 
     * Aging of the particle 
     */
    void aging();
    /** 
     * Move the particle randomly
     *
     * Using width and depth the boundary conditions are
     * automatically computed. Left and right side are swapping boundary conditions.
     * The top border is a reflection condition, the bottom border is a sink.
     */
    void move();
    /** 
     * Return the mass of the particle and mark it as inactive 
     */
    float get_eaten();
    /** 
     * Return the mass 
     */
    float get_mass(){return this->mass;}
    /** 
     * Return the age 
     */
    int get_age(){return this->age;}
    /**
     * Check if this particle is active 
     */
    bool is_active(){return this->active;}
    
    /**
     * Set this particle active
     * @param active
     */
    void set_active(bool active){this->active = active;}
    /**
     * Set the particle age
     * @param age
     */
    void set_age(int age){this->age = age;}
    /**
     * Set the particle mass
     * @param mass
     */
    void set_mass(float mass){this->mass = mass;}
    
protected:
    float mass;  /* randomly generated */
    unsigned int age;     /* time step counter */ 
    bool active; /* Set false if it was eaten  */
    bool is_doc; /* If this is set true, the particle is dissolved organic carbon
                  * and effected by gravity */
};
#endif